package dyyx.util;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

public class WebUtil{
	
	
	public static String getString(HttpServletRequest request,String name){
		if(request==null || name==null){
			return null;
		}
		String str = request.getParameter(name);
		if(str!=null){
			str = str.trim();
		}
		return str;
	}
	
	public static int getInt(HttpServletRequest request,String name){
		String str = getString(request,name);
		if(str==null){
			return 0;
		}
		return CommUtil.getInt(str);
	}
	 
	
	public static long getLong(HttpServletRequest request,String name){
		String str = getString(request,name);
		if(str==null){
			return 0;
		}
		return CommUtil.getLong(str);
	}
	
	public static List<String> getList(HttpServletRequest request,String name){
		return getList(request,name,CommConst.COMM);
	}

	
	public static List<String> getList(HttpServletRequest request,String name,String sep){
		if(sep==null || sep.length()<=0){
			sep = CommConst.COMM;
		}
		String str =  getString(request,name);
		return CommUtil.getList(str, sep);
	}

}
